from module_admin.dao.cms_order_execute_dao import CmsOrderExecuteDao
from module_admin.dao.dept_dao import *
from module_admin.entity.vo.cms_order_execute_vo import OrderExecuteModel
from utils.uuid import UUID


class CmsOrderExecuteService:
    """
    部门管理模块服务层
    """

    @classmethod
    def create_order_execute(cls, result_db: Session, page_object: OrderExecuteModel):
        page_object.id = int(UUID().uuid())
        return CmsOrderExecuteDao.create_order_execute(result_db, page_object)

    @classmethod
    def update_order_execute(cls, db, order_execute_update: OrderExecuteModel):
        order_execute_update_dict = order_execute_update.dict(exclude_unset=True)
        return CmsOrderExecuteDao.update_order_execute_by_id(db, order_execute_update_dict)
